

***
*creating OAS graphs

clear

use "$dir/data/data_public/acs_oas_graphs_data.dta"  //data from IPUMS

gen female = 0
	replace female = 1 if sex == 2
	
	keep if age >=15 & age<65
	gen pop  = 1
	
	gen emp = (empstat == 1) 
	
	keep if emp == 1
	
	gen hschool      = (educd>=62) if educd!=. 
	gen some_college = (educd>=64) if educd!=.
	gen some_college_emp     = (educd>=64) if educd!=. & emp == 1
	
	
	gen college = (educd>=101) if educd!=.
	
	gen college_emp = (educd>=101) if educd!=. & emp == 1
	

	gen oas             = (occ2010 >=5000  & occ2010<6000)
	gen non_oas = oas ==0 & occ2010>=10
	
	
	gen cat = 0 if oas == 1
	replace cat = 1 if non_oas == 1
	
	
	collapse   (first) occ2010  (sum) hschool (sum) some_college (sum) some_college_emp  ///
	(sum) college (sum) college_emp  (sum) pop (sum) emp   (sum) female  [pw=perwt], by(year cat)
	

	
	egen total_emp = total(emp), by(year)
	
	gen all = 1 
	gen oas = cat== 0
	gen non_oas = cat == 1
	
	foreach occ in oas non_oas all {
		// Occupation Share
		egen `occ'_lf = total(`occ'*emp), by(year)
		gen  `occ'_share = `occ'_lf*100/total_emp

		// college share (e.g. table D1)
		gen aux_scollege_`occ'     = some_college_emp * `occ'
		egen aux_cz_some_coll_`occ' = total(aux_scollege_`occ'), by(year)
		gen cz_some_coll_`occ'_pct = aux_cz_some_coll_`occ'*100/`occ'_lf
		// College
		gen aux_college_`occ' = college_emp * `occ'
		egen cz_college_`occ' = total(aux_college_`occ'), by(year)
		gen cz_college_`occ'_pct = cz_college_`occ'*100/`occ'_lf
		
	   gen aux_female_`occ'     = female * `occ'
	  egen female_share_`occ' = total(aux_female_`occ'), by(year)
	  
	  }
	  
	  drop aux_*
	  
	  collapse   *_share cz_* female_* , by(year) fast


save "$dir/data/interim/oas_employment_graphs_data.dta", replace

*next want to create the graphs
keep if year>=1950
twoway (connected oas_share year , lcolor(black) mcolor(black)), graphregion(color(white)) ylabel(,nogrid angle(horizontal)) ///
legend(off) xtitle("Year") ytitle("OAS % of Employment")

graph export  "$dir/output\oas_share_graph.pdf",  as(pdf) replace


twoway (connected cz_college_oas_pct year , lcolor(black) mcolor(black)) ///
(connected cz_college_non_oas_pct year , lcolor(gray) mcolor(gray)), graphregion(color(white)) ylabel(,nogrid angle(horizontal)) ///
legend(off) xtitle("Year") ytitle("Percent with College Degree") ///
text(37 2000 "Non-OAS", place(e)) text(19 2000 "OAS", place(e))

graph export  "$dir/output\college_share_graph.pdf",  as(pdf) replace





*OEWS data
*Table A.1: OAS Minor Occupational Categories
clear
 import excel "$dir\data\data_public\national_M2016_dl.xlsx", sheet("national_dl") firstrow
 
 
 keep if substr(OCC_CODE, 1, 2) == "43" | OCC_CODE == "00-0000"
 keep OCC_CODE OCC_TITLE OCC_GROUP TOT_EMP

 sum TOT_EMP if OCC_CODE == "00-0000"

 format TOT_EMP %20.0f
 
 keep if OCC_GROUP == "minor"  | OCC_GROUP == "total" | OCC_GROUP == "major"
 
 gen temp = TOT_EMP if OCC_CODE == "43-0000"
 egen temp2 = min(temp) 
 gen oas_share = TOT_EMP/temp2
 
 keep OCC_CODE OCC_TITLE TOT_EMP oas_share
 
  gen temp = TOT_EMP if OCC_CODE == "00-0000"
 egen temp2 = min(temp) 
 gen share_all = TOT_EMP/temp2
 
 drop temp temp2
 
 export excel using "$dir\output\table_A1_OAS_minor_occs.xls", replace  firstrow(variables)

 




use "$dir\data\cleaned\estimation_data.dta", clear
do "$dir/code/llm_build/13.merging_alt_instruments.do"




**Appendix Table A.6: Descriptive Statistics of Key Variables

sum oas_share oas_pop_pct  oas_college_pct oas_cz_lwg_annual_r  non_oas_cz_lwg_annual_r lwg_annual_r  epop100
sum czone_sh_manufac  czone_sh_services czone_sh_college  czone_sh_foreign  flfp100 mlfp100 
sum contemp_mean_alt_std  inst_mean_ind_std_2000


 *Figure B4
use "$dir\data\interim\occs_female_college.dta", clear


	
twoway (scatter female college if major_occ !="OAS", mcolor(black) mlabel(major_occ) mlabcolor(black) mlabsize(vsmall)  mlabposition(3))  || ///
(scatter female college if major_occ =="OAS", mcolor(red) mlabel(major_occ) mlabcolor(red) mlabsize(small) mlabposition(6) ///
yline(0.5, lcolor(black)) xline(0.4, lcolor(black)) ylabel(0(0.2)1) xlabel(0(0.2)1) ///
graphregion(color(white)) ylabel(,nogrid) legend(off) ytitle("Female Share") xtitle("College Share") ///
text(0.95 0.2 "Pink Collar", place(e))  text(0.95 0.5 "White Collar (Female)", place(e)) text(0.05 0.2 "Blue Collar", place(e))  text(0.05 0.5 "White Collar (Male)", place(e)))

graph export "$dir/output/figB4.pdf", replace



*Table C.1: Example Industry OAS Share of Employment, 2000

*industry oas intensity in 2000

use  "$dir\data\interim\occ_by_ind_weights_by_year.dta" , clear
keep if year == 2000

gen oas = (total-nonoas)/total

collapse (first) oas (first) total, by(ind1990)
drop if total <=40000 //only keep large industries 
sort oas
drop if _n>5 & _n<=_N-5

export excel using "$dir\output\example_industry_oas_share.xls", replace  firstrow(variables)




 
 *Table  C.2: Average Mentioned Software Names per Job Ad, Ten Largest OAS Occupations

 
clear
 import excel "$dir\data\data_public\national_M2016_dl.xlsx", sheet("national_dl") firstrow
 
 
 keep if substr(OCC_CODE, 1, 2) == "43"
 

keep OCC_CODE OCC_TITLE TOT_EMP

sort TOT_EMP

ren OCC_CODE soc2010

tab TOT_EMP if soc2010 == "43-0000"

destring soc2010, replace ignore("-")

merge 1:m soc2010 using "$dir\data\interim\mean_tech_by_cz_census_2016_collapsed.dta"
keep if _merge ==3

collapse mean_count_tech TOT_EMP (first) OCC_TITLE, by(soc2010 year)

keep if year == 2007 | year == 2016

reshape wide mean_count_tech TOT_EMP OCC_TITLE, i(soc2010) j(year)
drop TOT_EMP2016 OCC_TITLE2016

ren TOT_EMP2007 TOT_EMP
ren OCC_TITLE2007 OCC_TITLE

sort TOT_EMP

gen chg_tech = mean_count_tech2016-mean_count_tech2007

keep if _n>_N-10

gsort -TOT_EMP

 export excel using "$dir\output\table_C2_av_software.xls", replace  firstrow(variables)
 


*Figure C.1 Geographic Variation in Technology Intensity Measure, 2016
 
 use "$dir/data/interim/mean_tech_by_cz_census_2016_collapsed.dta", clear 
 
keep if year == 2016

merge m:1 czone year census2010 using   "$dir/data/interim/oas_cz_weights_2016.dta"

keep if _merge == 3

collapse  mean_any_tech [weight=oas_share_oas], by(czone)

ren czone cz

maptile mean_any_tech, geo(cz1990) legdecimals(2) 

graph export "$dir\output\oas_tech_czone.pdf", as(pdf) replace




use "$dir\data\cleaned\estimation_data.dta", clear
do "$dir/code/llm_build/13.merging_alt_instruments.do"





*Figure C.2: Relationship between Instrument and Endogenous Technology Measure	
	preserve

	keep oas_share  contemp_mean_oas_std  year czone czone_pop inst_mean_ind_std_2000 inst_mean_ind_std_1970 
reshape wide oas_share  contemp_mean_oas_std czone_pop inst_mean_ind_std_2000 inst_mean_ind_std_1970,  i(czone)  j(year)

gen oas_pct_chg = oas_share2016-oas_share2007
gen tech_chg = contemp_mean_oas_std2016-contemp_mean_oas_std2007
gen inst_chg1970 = inst_mean_ind_std_19702016-inst_mean_ind_std_19702007


twoway (lfit tech_chg  inst_chg1970 [aweight=czone_pop2007], lcolor(black)) ///
(scatter tech_chg  inst_chg1970 [aweight=czone_pop2007], msymbol(circle_hollow) mcolor(black)), ///
graphregion(color(white)) ylabel(,nogrid) legend(off) xtitle("Change in 1970 Instrument, 2007-2016") ytitle("Change in Endogenous Tech. Measure")
graph export "$dir/output/figC2_endog_1970inst.pdf", as(pdf) replace

	restore

	

	
*Table C.3: First Stage
		reg $endog yr2_* cz2_* $inst_1970     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/C3_FS.xls", replace dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
				reg $endog yr2_* cz2_* $inst_2000   [aweight=czone_pop],vce(cl czone)		

		outreg2   using "$dir/output/C3_FS.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)	


*want the ftests
		ivregress 2sls oas_share  yr2_* cz2_* ($endog   =  $inst_1970 )       [aweight=czone_pop], cluster(czone) 
		estat firststage
				ivregress 2sls oas_share  yr2_* cz2_* ($endog   =  $inst_2000 )       [aweight=czone_pop], cluster(czone) 
				estat firststage

		
*Table C.4: Correlation between Instruments and Commuting Zone Characteristics
	



reg  czone_pop1000s_dif  inst_mean_ind_std_1970 if year == 2007 [aweight=czone_pop] , vce(cl czone )

outreg2   using "$dir/output/TableC4_corr_w_insts.xls", replace dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_* o.*) cttop(1970)

foreach var in czone_sh_manufac czone_sh_services  czone_sh_college czone_sh_fem_emp czone_sh_black czone_sh_asian czone_sh_foreign    {

reg  `var'_dif  inst_mean_ind_std_1970 if year == 2007 [aweight=czone_pop] , vce(cl czone )

outreg2   using "$dir/output/TableC4_corr_w_insts.xls", append dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_* o.*) cttop(1970)
 
}


foreach var in czone_pop1000s czone_sh_manufac czone_sh_services  czone_sh_college czone_sh_fem_emp czone_sh_black czone_sh_asian czone_sh_foreign      {

reg  `var'_dif  inst_mean_ind_std_2000 if year == 2007 [aweight=czone_pop] , vce(cl czone )

 outreg2   using "$dir/output/TableC4_corr_w_insts.xls", append dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_* o.*) cttop(main)
 
}


foreach var in czone_pop1000s czone_sh_manufac czone_sh_services  czone_sh_college czone_sh_fem_emp czone_sh_black czone_sh_asian czone_sh_foreign      {

reg  `var'_dif  bus_norm if year == 2007 [aweight=czone_pop] , vce(cl czone )

 outreg2   using "$dir/output/TableC4_corr_w_insts.xls", append dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_* o.*) cttop(bus)
 
}	
	

foreach var in czone_pop1000s czone_sh_manufac czone_sh_services  czone_sh_college czone_sh_fem_emp czone_sh_black czone_sh_asian czone_sh_foreign      {

reg `var'_dif inst_mean_ind_std_1970  if lg_cz ==0 & year == 2007   [aweight=czone_pop] , vce(cl czone )

 outreg2   using "$dir/output/TableC4_corr_w_insts.xls", append dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_* o.*) cttop(excl lg)
 
}



	
*Table C.5: Alternative Specifications

*IV, 1970 industry weights

		reg $endog   yr2_* cz2_* $inst_1970    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", replace dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
		
				
		*fttest
		
			ivregress 2sls oas_pop_pct  yr2_* cz2_* ($endog   =  $inst_1970 )     [aweight=czone_pop], vce(cl czone)
			estat firststage
		
		
		
foreach var in oas_pop_pct  oas_college_pct epop100 lwg_annual_r non_oas_cz_lwg_yr_nocol_r oas_nc_wage_gap oas_col_wage_gap  {

		

		ivregress 2sls `var'  yr2_* cz2_*  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
	}
	
	
			
*IV, 2000 industry weights
	reg $endog   yr2_* cz2_* $inst_2000    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
		
		
					ivregress 2sls oas_pop_pct  yr2_* cz2_* ($endog   =  $inst_2000 )     [aweight=czone_pop], vce(cl czone)
			estat firststage
		

foreach var in oas_pop_pct  oas_college_pct epop100 lwg_annual_r non_oas_cz_lwg_yr_nocol_r oas_nc_wage_gap oas_col_wage_gap  {


		ivregress 2sls `var'  yr2_* cz2_*  ($endog   =  $inst_2000)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
	}	
	


*robustness 1: drop largest czones

*first stage
		reg $endog   yr2_* cz2_* $inst_1970  if lg_cz ==0     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
		
		*fttest
		
			ivregress 2sls oas_pop_pct  yr2_* cz2_* ($endog   =  $inst_1970 )   if lg_cz ==0   [aweight=czone_pop], vce(cl czone)
			estat firststage
		
*2sls		
		
foreach var in oas_pop_pct  oas_college_pct epop100 lwg_annual_r non_oas_cz_lwg_yr_nocol_r oas_nc_wage_gap oas_col_wage_gap  {
	
		ivregress 2sls `var'  yr2_* cz2_* ($endog   =  $inst_1970 )   if lg_cz ==0  [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
		
	}
	
	
*robustness 2: bus instrument
	

	
	*ftest
	ivregress 2sls oas_pop_pct   yr2_* cz2_* ($endog   = t*_ind_share401 )       [aweight=czone_pop], vce(cl czone)
	
	estat firststage
	
	
	*2sls
	

foreach var in oas_pop_pct  oas_college_pct epop100 lwg_annual_r non_oas_cz_lwg_yr_nocol_r oas_nc_wage_gap oas_col_wage_gap  {
	
		ivregress 2sls `var'  yr2_* cz2_* ($endog   = t*_ind_share401 )   [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
	}	
			
			
	*robustness 3 control for covariates
	

	*first stage
		
	local var contemp_mean_oas_std
		*local date: display  %td_CCYYNNDD date(c(current_date), "DMY")
		reg `var'   yr2_* cz2_* inst_mean_ind_std_1970 czone_sh_manufac  czone_sh_services czone_sh_college  czone_sh_foreign  czone_sh_fem_emp [aweight=czone_pop] , vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)


		*fttest
		
ivregress 2sls oas_pop_pct   yr2_* cz2_*  czone_sh_manufac  czone_sh_services czone_sh_college  czone_sh_foreign  czone_sh_fem_emp ($endog   =  $inst_1970 )     [aweight=czone_pop], vce(cl czone)
estat firststage
		
		
	*2sls


foreach var in oas_pop_pct  oas_college_pct epop100 lwg_annual_r non_oas_cz_lwg_yr_nocol_r oas_nc_wage_gap oas_col_wage_gap  {
	
	
		ivregress 2sls `var'  yr2_* cz2_* czone_sh_manufac  czone_sh_services czone_sh_college  czone_sh_foreign  czone_sh_fem_emp  (contemp_mean_oas_std  =   inst_mean_ind_std_1970  ) [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
	}		
	
	*robustness 4: MS office
	
	*first stage
	
	local var contemp_any_office_std
		*local date: display  %td_CCYYNNDD date(c(current_date), "DMY")
		reg `var'  yr2_* cz2_* inst_office_ind_std_1970    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
	
	*ftest
	ivregress 2sls oas_pop_pct   yr2_* cz2_* (contemp_any_office_std  = inst_office_ind_std_1970 )       [aweight=czone_pop], vce(cl czone)
	
	estat firststage
	
	
	*2sls
	


foreach var in oas_pop_pct  oas_college_pct epop100 lwg_annual_r non_oas_cz_lwg_yr_nocol_r oas_nc_wage_gap oas_col_wage_gap  {
	
	
		ivregress 2sls `var'   yr2_* cz2_* (contemp_any_office_std  = inst_office_ind_std_1970 )   [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)

	}	
		

	
	
	
	
	*robustness 5: drop the top 10% of tech adopting czones in 2007
	

	
	*first stage
	
		
	local var contemp_mean_oas_std
		*local date: display  %td_CCYYNNDD date(c(current_date), "DMY")
		reg `var'  yr2_* cz2_* inst_mean_ind_std_1970  if top10_flag<1 [aweight=czone_pop] , vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
	
	
	*fttest
	
		ivregress 2sls oas_pop_pct   yr2_* cz2_* (contemp_mean_oas_std  =   inst_mean_ind_std_1970  )  if top10_flag<1    [aweight=czone_pop], vce(cl czone)
	
	estat firststage
	
		
		
		
	
	*2sls

foreach var in oas_pop_pct  oas_college_pct epop100 lwg_annual_r non_oas_cz_lwg_yr_nocol_r oas_nc_wage_gap oas_col_wage_gap  {
	
	
		ivregress 2sls `var'  yr2_* cz2_*  (contemp_mean_oas_std  =   inst_mean_ind_std_1970  )  if top10_flag<1 [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
	}
	
	

		
	*robustness 6: drop the bottom 10% of tech adopting czones in 2007
	

*first stage
	
	local var contemp_mean_oas_std
		*local date: display  %td_CCYYNNDD date(c(current_date), "DMY")
		reghdfe `var' yr2_* cz2_*  inst_mean_ind_std_1970   if bottom10_flag<1 [aweight=czone_pop] ,  absorb(year czone) vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
	
			
		ivregress 2sls oas_pop_pct   yr2_* cz2_* (contemp_mean_oas_std  =   inst_mean_ind_std_1970  )  if bottom10_flag<1    [aweight=czone_pop], vce(cl czone)
	
	estat firststage
	
	
	*2sls

foreach var in oas_pop_pct  oas_college_pct epop100 lwg_annual_r non_oas_cz_lwg_yr_nocol_r oas_nc_wage_gap oas_col_wage_gap  {
	
	
		ivregress 2sls `var'  yr2_* cz2_*  (contemp_mean_oas_std  =   inst_mean_ind_std_1970  )  if bottom10_flag<1 [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC5_altspecs.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
	}
	
	
		
*Note: stacked long differences is produced in the long_diff_specs.do file
	
	
	
*Table C.6: Employment Rate and Endogenous Technology	
		reghdfe epop100  $endog     [aweight=czone_pop], vce(cl czone) absorb(year czone)
		outreg2   using "$dir/output/tableC6.xls", append dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_*  o.*)	 	
	reghdfe epop100  mno_count_issoftware_std     [aweight=czone_pop], vce(cl czone) absorb(year czone)
		outreg2   using "$dir/output/tableC6.xls", append dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_*  o.*)
		
reghdfe  mno_count_issoftware_std    [aweight=czone_pop], vce(cl czone) absorb(czone)	residuals(mno_resid)

reghdfe  $endog    [aweight=czone_pop], vce(cl czone) absorb(czone)	residuals(endog_resid)		
		
corr mno_resid endog_resid //0.3466

corr mno_resid endog_resid [aweight= czone_pop] //0.6594

		
		
		
*Table C.7: Spillovers, Technology Control	

foreach var in epop100  flfp100 mlfp100 {
		ivregress 2sls `var'  yr2_* cz2_*   ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tablec7_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	
		ivregress 2sls `var'  yr2_* cz2_* mno_count_issoftware_std  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tablec7_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	}
	
	
*Table C.8: Non-OAS Technology and College Share
		ivregress 2sls oas_college_pct   yr2_* cz2_*   ($endog  =  $inst_1970)     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tablec8_panelA.xls", replace dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_*  o.*)	
	
		ivregress 2sls oas_college_pct czone_sh_college  yr2_* cz2_*   ($endog  =  $inst_1970)     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tablec8_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_*  o.*)	
		
		ivregress 2sls non_oas_college_pct   yr2_* cz2_*   ($endog  =  $inst_1970)     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tablec8_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_*  o.*)	
	
		ivregress 2sls non_oas_college_pct czone_sh_college  yr2_* cz2_*  ($endog  =  $inst_1970)     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tablec8_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_*  o.*)	
	
	
		ivregress 2sls oas_college_pct mno_count_issoftware_std   yr2_* cz2_*   ($endog  =  $inst_1970)     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tablec8_panelB.xls", replace dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_*  o.*)	
	
		ivregress 2sls oas_college_pct mno_count_issoftware_std  czone_sh_college  yr2_* cz2_*   ($endog  =  $inst_1970)     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tablec8_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_*  o.*)	
		
		ivregress 2sls non_oas_college_pct mno_count_issoftware_std    yr2_* cz2_*   ($endog  =  $inst_1970)     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tablec8_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_*  o.*)	
	
		ivregress 2sls non_oas_college_pct mno_count_issoftware_std  czone_sh_college  yr2_* cz2_*   ($endog  =  $inst_1970)     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tablec8_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05, 0.1) symbol(***, **, *, +) drop(yr2_* cz2_*  o.*)	
	

	

*Table C.9: Wages and Non-OAS Technology	
foreach var in lwg_annual_r non_oas_cz_lwg_annual_r non_oas_cz_lwg_yr_col_r  non_oas_cz_lwg_yr_nocol_r {
		ivregress 2sls `var'  yr2_* cz2_*   ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC9_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	
		ivregress 2sls `var'  yr2_* cz2_* mno_count_issoftware_std  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC9_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	}	
	
	
*Table C.10 OAS outcomes and non-OAS Technology
foreach var in oas_share oas_pop_pct  oas_college_pct oas_cz_lwg_annual_r oas_cz_lwg_yr_col_r  oas_cz_lwg_yr_nocol_r  {
		ivregress 2sls `var'  yr2_* cz2_*   ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC10_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	
		ivregress 2sls `var'  yr2_* cz2_* mno_count_issoftware_std  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC10_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	}	
	
		



	*Table C.11: Employment and Wages by Occupational Groups
	global collar  blue_collar pink_collar white_collar white_m_collar white_f_collar  
	

foreach var in  _pop_pct  _college_pct _cz_lwg_annual_r _cz_lwg_yr_col_r  _cz_lwg_yr_nocol_r 	 _dlw_annual_r  {
foreach occ of global collar  {
		
*IV, 1970 industry weights
		ivregress 2sls `occ'`var'  yr2_* cz2_*  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/TableC11_panel_`occ'.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	}
	
	}	

	
	
*Table C.12: Employment and Wages by Major Occupation
	
global occupations oas hlth_spprt prsnal_care food_prep  sales ///
const ins_mntnc_rpr production  transport protection   bldng_mntnce 	farm  ///
com_scl_srvc heal  education bus_fin_op ///
mgmt pc_math arch_eng  phys_scl_scnc legal arts_dsgn
	

foreach var in  _pop_pct   _cz_lwg_annual_r _cz_lwg_yr_col_r  _cz_lwg_yr_nocol_r 	  {
foreach occ of global occupations  {
		
*IV, 1970 industry weights
		ivregress 2sls `occ'`var'  yr2_* cz2_*  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/TableC12_panel`occ'.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	}
	
	}	
	
	
*Table C.13: Demographic Sub-Groups		

foreach var in  femnocol_epop100 femcol_epop100  malenocol_epop100 malecol_epop100 ///
	lwg_yr_femnocol_r lwg_yr_femcol_r lwg_yr_malenocol_r lwg_yr_malecol_r 	  {
		ivregress 2sls `var'  yr2_* cz2_*  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/TableC13.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	}

	
	
*Table C.14: Spillover of OAS Tech. on College Share of Other Occupations
	
	
*panel A: endogenous regression
		reg  oas_college_pct    yr2_* cz2_* $endog     [aweight=czone_pop], r
		outreg2   using "$dir/output/TableC14_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)

		reg  oas_college_pct  czone_sh_college  yr2_* cz2_* $endog     [aweight=czone_pop], r
		outreg2   using "$dir/output/TableC14_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
		reg  non_oas_college_pct   yr2_* cz2_* $endog     [aweight=czone_pop], r
		outreg2   using "$dir/output/TableC14_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
		reg  non_oas_college_pct  czone_sh_college  yr2_* cz2_* $endog     [aweight=czone_pop], r
		outreg2   using "$dir/output/TableC14_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	
*panel B: reduced form, 1970 industry weights
		reg  oas_college_pct   yr2_* cz2_* $inst_1970    [aweight=czone_pop], r
		outreg2   using "$dir/output/TableC14_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
		reg  oas_college_pct czone_sh_college yr2_* cz2_* $inst_1970    [aweight=czone_pop], r
		outreg2   using "$dir/output/TableC14_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)

		
		reg  non_oas_college_pct   yr2_* cz2_* $inst_1970    [aweight=czone_pop], r
		outreg2   using "$dir/output/TableC14_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)

		
		reg  non_oas_college_pct czone_sh_college yr2_* cz2_* $inst_1970    [aweight=czone_pop], r
		outreg2   using "$dir/output/TableC14_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)


		
*panel C: IV, 1970 industry weights
		ivregress 2sls oas_college_pct   yr2_* cz2_*  ($endog  =  $inst_1970)     [aweight=czone_pop], r
		outreg2   using "$dir/output/TableC14_panelC.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)	

		ivregress 2sls oas_college_pct czone_sh_college  yr2_* cz2_*  ($endog  =  $inst_1970)     [aweight=czone_pop], r
		outreg2   using "$dir/output/TableC14_panelC.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)		
	
		ivregress 2sls non_oas_college_pct   yr2_* cz2_*  ($endog  =  $inst_1970)     [aweight=czone_pop], r
		outreg2   using "$dir/output/TableC14_panelC.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)	
		
		ivregress 2sls non_oas_college_pct czone_sh_college  yr2_* cz2_*  ($endog  =  $inst_1970)     [aweight=czone_pop], r
		outreg2   using "$dir/output/TableC14_panelC.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
	
*Table C.15: Employment Outcomes for OAS Workers
foreach var in oas_share oas_pop_pct  oas_college_pct   {

	*endogenous regression
		reg `var'  yr2_* cz2_* $endog     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC15_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)

		*reduced form, 2000 industry weights
		reg `var'  yr2_* cz2_* $inst_2000      [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC15_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)

*reduced form, 1970 industry weights
		reg `var'  yr2_* cz2_* $inst_1970      [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC15_panelC.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
*IV, 2000 industry weights
		ivregress 2sls `var'  yr2_* cz2_* ($endog   =  $inst_2000 )    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC15_panelD.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
*IV, 1970 industry weights
		ivregress 2sls `var'  yr2_* cz2_*  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC15_panelE.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	}
	

	*	Table C.16: Real Annual Log Wages for OAS Workers
foreach var in  oas_cz_lwg_annual_r oas_cz_lwg_yr_col_r  oas_cz_lwg_yr_nocol_r  {
	
	*endogenous regression
		reg `var'  yr2_* cz2_* $endog     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC16_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)

		*reduced form, 2000 industry weights
		reg `var'  yr2_* cz2_* $inst_2000      [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC16_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)

*reduced form, 1970 industry weights
		reg `var'  yr2_* cz2_* $inst_1970      [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC16_panelC.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
*IV, 2000 industry weights
		ivregress 2sls `var'  yr2_* cz2_* ($endog   =  $inst_2000 )    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC16_panelD.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
*IV, 1970 industry weights
		ivregress 2sls `var'  yr2_* cz2_*  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC16_panelE.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	}
	

*Table C.17: Employment-to-Population Ratio
foreach var in epop100 flfp100 mlfp100   { 

	*endogenous regression
		reg `var'  yr2_* cz2_* $endog     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC17_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)

		*reduced form, 2000 industry weights
		reg `var'  yr2_* cz2_* $inst_2000      [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC17_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)

*reduced form, 1970 industry weights
		reg `var'  yr2_* cz2_* $inst_1970      [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC17_panelC.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
*IV, 2000 industry weights
		ivregress 2sls `var'  yr2_* cz2_* ($endog   =  $inst_2000 )    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC17_panelD.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
*IV, 1970 industry weights
		ivregress 2sls `var'  yr2_* cz2_*  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC17_panelE.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	}	
	
*Table C.18: OAS Wage Premium	
foreach var in oas_nc_wage_gap oas_col_wage_gap oas_nc_nc_wage_gap  oas_col_col_wage_gap { 

		
	*endogenous regression
		reg `var'  yr2_* cz2_* $endog     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC18_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)

		*reduced form, 2000 industry weights
		reg `var'  yr2_* cz2_* $inst_2000      [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC18_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)

*reduced form, 1970 industry weights
		reg `var'  yr2_* cz2_* $inst_1970      [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC18_panelC.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
*IV, 2000 industry weights
		ivregress 2sls `var'  yr2_* cz2_* ($endog   =  $inst_2000 )    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC18_panelD.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
*IV, 1970 industry weights
		ivregress 2sls `var'  yr2_* cz2_*  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC18_panelE.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	}
	
	
*Table C.19: Real Annual Log Wage Spillover
foreach var in lwg_annual_r non_oas_cz_lwg_annual_r non_oas_cz_lwg_yr_col_r  non_oas_cz_lwg_yr_nocol_r  { 

	*endogenous regression
		reg `var'  yr2_* cz2_* $endog     [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC19_panelA.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)

		*reduced form, 2000 industry weights
		reg `var'  yr2_* cz2_* $inst_2000      [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC19_panelB.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)

*reduced form, 1970 industry weights
		reg `var'  yr2_* cz2_* $inst_1970      [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC19_panelC.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
*IV, 2000 industry weights
		ivregress 2sls `var'  yr2_* cz2_* ($endog   =  $inst_2000 )    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC19_panelD.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
		
*IV, 1970 industry weights
		ivregress 2sls `var'  yr2_* cz2_*  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/tableC19_panelE.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_* o.*)
	}
	
	
